import { Allow, ArrayNotEmpty, IsArray, IsNotEmpty, Length, MaxLength, } from "class-validator";
import BaseEntity from "./BaseEntity";
import { Type } from "class-transformer";
import { IQuestionItem } from "./constraints";

export default class QuestionEntity extends BaseEntity {

  public 'id': string

  @Length(1, 255)
  public 'title': string

  @MaxLength(255)
  public 'analyze': string // 解析

  @Type(() => Object)
  @ArrayNotEmpty()
  @IsArray()
  public 'items': IQuestionItem[] // 选项

  @IsNotEmpty()
  public 'correct': string // 标答

  // @IsInt()
  @Type(() => Number)
  @IsNotEmpty()
  public 'score': number // 截止时间
}